Algorithm 'python script'

The algorithm 'execute python script' allows the processing of python files (*.py ) or the insertion of Python scripts directly into the algorithm (inline python code).


Algorithm 'execute python script'

Domain

pixel level; image object level

Algorithm parameters

Python script location

Option to choose between executing of a Python file (*.py) or select Inline to insert a python script directly in this algorithm.

Python script path

Select the path to an existing python script file. (Only available for selection of Python script location > Python file.)

Inline python script

Insert an inline python script (Only available for selection of Python script location > Inline.) See examples in chapter Default inline python script below.

Python function

Insert a python function name to be called in double quotes. (The script has to contain at least one function to be inserted here.) Example: "image_normalization".

External script paths

Option to add an array of external script paths, that will be appended to sys.path list before executing the function.

Input

Use image layer array

Select 'Yes' if you want to use image layer arrays instead of image layer selection.

Image layers

Select input image layers. (Only available for selection of Use image layer array > No.) If an unassigned layer is selected as input for the python script algorithm, it is passed as "None" value into the script.

Image layer array

Select the input image layer array. (Only available for selection of Use image layer array > Yes.)

Vector layers

Select the input vector layers. If an unassigned layer is selected as input for the python script algorithm, it is passed as "None" value into the script.

Point cloud layers

Select the input point cloud layers. If an unassigned layer is selected as input for the python script algorithm, it is passed as "None" value into the script.

variable0

Insert variable (max number of variables that can be inserted is limited to 15)

region0

Insert region (max number of regions that can be inserted is limited to 15)

array0

Insert array (max number of arrays that can be inserted is limited to 15)

 

See also:

Installation Guide > Windows > Python Installation - installation and setup

Reference Book > Algorithms and Processes > Miscellaneous > Embedded Python API Reference - reference for each class, properties and methods

User Guide > Python Integration - application examples for python scripts